package com.cskaoyan.mall.service.admin;

import com.cskaoyan.mall.dao.admin.AdminDao;
import com.cskaoyan.mall.dao.admin.AdminDaoImpl;
import com.cskaoyan.mall.model.Admin;
import com.cskaoyan.mall.model.bo.admin.AdminAddBO;
import com.cskaoyan.mall.model.bo.admin.AdminLoginBO;
import com.cskaoyan.mall.model.bo.admin.ChangePwdBO;
import com.cskaoyan.mall.model.bo.admin.SearchAdminBO;

import java.util.List;

public class AdminServiceImpl implements AdminService{
    private AdminDao adminDao = new AdminDaoImpl();
    @Override
    public int login(AdminLoginBO loginBO) {
        return adminDao.login(loginBO);
    }

    @Override
    public List<Admin> allAdmins() {
        return adminDao.allAdmins();
    }

    @Override
    public List<Admin> searchAdmins(SearchAdminBO searchAdminBO) {
        return adminDao.searchAdmins(searchAdminBO);
    }

    /**
     * 添加管理员账号
     * @param adminAddBO
     * @return
     */
    @Override
    public int add(AdminAddBO adminAddBO) {
        return adminDao.addAdminss(adminAddBO);
    }

    /**
     * 修改管理员账号
     * @param admin
     * @return
     */
    @Override
    public int update(Admin admin) {
        return adminDao.updateAdminss(admin);
    }

    /**
     * 获取指定ID的管理员信息
     * @param id
     * @return
     */
    @Override
    public Admin getAdminInfo(String id) {
        return adminDao.getAdminInfo(id);
    }

    /**
     * 删除指定id的管理员信息
     * @param id
     * @return
     */
    @Override
    public int deleteAdmins(String id) {
        return adminDao.deleteAdmins(id);
    }

    @Override
    public int changePwd(ChangePwdBO changePwdBO) {
        return adminDao.changePwd(changePwdBO);
    }
}
